class Goods:
    discount=0.8
    def __init__(self,name,origin_price):
        self.name=name
        self.__price=origin_price
    @property
    def price(self):
        return self.__price*self.discount

    @price.setter
    def price(self,new_value):
        if isinstance(new_value,int):
            print('调用我啦')
            self.__price=new_value
        else:
            print('请输入数字')
    @price.deleter
    def price(self):
        print('执行delete')
        del self.__price

apple=Goods('apple',5)
# apple.price=10   AttributeError: can't set attribute,没写 @price.setter，def price(self,new_value):之前
print(apple.price)#调用的是被@property装饰的price
apple.price=10#调用的是被@setter装饰的price
print(apple.price)
apple.price='abc'
# del apple.price  AttributeError: can't delete attribute
del apple.price# 并不能删除什么，只是调用对应的被@price.deleter装饰的方法而已
# print(apple.price)  AttributeError: 'Goods' object has no attribute '_Goods__price'






